<template>
    <div>   
      <el-button type="primary" plain @click="addRecord">添加</el-button>
      <el-button type="primary" plain @click="quxiao">返回</el-button>  
       
      <el-table :data="tableData" style="width: 70%" >
        <el-table-column
          prop="date"
          label="检测时间"
          width="180">
        </el-table-column>
        <el-table-column 
          prop="hsresult"
          label="核酸结果"
          width="180">
        </el-table-column>
        <el-table-column
          prop="ctresult"
          label="CT结果">
        </el-table-column>
        <el-table-column prop="address" label="操作">
          <el-button type="danger" @click="open">删除</el-button>
        </el-table-column>
      </el-table>
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage4"
        :page-sizes="[100, 200, 300, 400]"
        :page-size="100"
        layout="total, sizes, prev, pager, next, jumper"
        :total="400">
      </el-pagination>

    </div>
</template>

<script>
    export default {
      data() {
        return {
          currentPage1: 5,
          currentPage2: 5,
          currentPage3: 5,
          currentPage4: 4,
          tableData: [{
            date: '2016-05-02',
            hsresult: '阴性',
            ctresult: '阴性'
          }, 
          {
            date: '2016-05-02',
            hsresult: '阴性',
            ctresult: '阴性'
          }, 
          {
            date: '2016-05-02',
            hsresult: '阴性',
            ctresult: '阴性'
          }, 
          
          ],
        }
      },
      methods:{
          quxiao(){
            history.go(-1)
          },
          handleSizeChange(val) {
            console.log(`每页 ${val} 条`);
          },
          handleCurrentChange(val) {
            console.log(`当前页: ${val}`);
          },
          open() {
            this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning'
            }).then(() => {
              this.$message({
                type: 'success',
                message: '删除成功!'
              });
            }).catch(() => {
              this.$message({
                type: 'info',
                message: '已取消删除'
              });          
            });
          },
          addRecord(){
            this.$router.push({
              path:"/testrecord/addrecord"
            })
          }
      }
    }
  </script>